import Vue from "vue";
import VueRouter from "vue-router";
import Home from "@/views/Home.vue";
import Login from "@/views/Login.vue";
import Register from "@/views/Register.vue";
import PersonalIndex from "@/views/personal/Index.vue";
import RersonalEdit from "@/views/personal/Edit.vue";
import Test from "@/views/Test.vue";
import PersonalFollows from "@/views/personal/Follwos.vue";
import PersonalStar from "@/views/personal/Star.vue";
import PostDetail from "@/views/PostDetail.vue";
import MoreComment from "@/views/MoreComment";
import Search from "@/views/Search";
import Manage from "@/views/Manage";

Vue.use(VueRouter);

// 创建路由对象
const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/Test",
    component: Test,
  },
  {
    path: "/login",
    component: Login,
  },

  {
    path: "/Register",
    component: Register,
  },
  // 路由配置有一个属相专门给我们放自定义数据
  {
    path: "/personal",
    component: PersonalIndex,
    meta: {
      needAuth: true,
    },
  },
  {
    path: "/edit",
    component: RersonalEdit,
    meta: {
      needAuth: true,
    },
  },
  {
    path: "/follows",
    meta: {
      needAuth: true,
    },
    component: PersonalFollows,
  },
  {
    path: "/star",
    meta: {
      needAuth: true,
    },
    component: PersonalStar,
  },
  {
    path: "/PostDetail",
    component: PostDetail,
  },
  {
    path: "/morecomment",
    component: MoreComment,
  },
  {
    path: "/Search",
    component: Search,
  },
  {
    path: "/Manage",
    component: Manage,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
